home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4382 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  976 b 

  1. Path: castle.nando.net!news
  2. From: actuary@nando.net   (Bill McCarthy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: random number
  5. Date: 4 Feb 1996 03:41:51 GMT
  6. Organization: News & Observer Public Access
  7. Message-ID: <4f19tv$i28@castle.nando.net>
  8. References: <1996Feb4.020051.12889@dcs.warwick.ac.uk>
  9. Reply-To: actuary@nando.net (Bill McCarthy)
  10. NNTP-Posting-Host: grail802.nando.net
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <1996Feb4.020051.12889@dcs.warwick.ac.uk>, D.C.Molero@dcs.warwick.ac.uk (Daniel Castillo Molero) writes:
  14. >Hi,
  15. >Could anybody help me to generate some code to produce
  16. >a random number between -3 and 3 ?
  17. >I'm trying to use rand(), but since it doesn't receive
  18. >any argument, I cannot specify the range. Probably one
  19. >way would be to access the constant RAND_MAX, but I don't know
  20. >how to do this, since I'm new in c.
  21. >Any help will be grately appreciated.
  22.  
  23. Just grep the FAQ for rand and you'll see how it's done.
  24.  
  25. Bill McCarthy
  26. actuary@nando.net
  27. Wendell, NC  USA
  28.  
  29.